﻿using System.Text.RegularExpressions;
using System.Windows.Input;

namespace BeeCoders.Tools.ControlCanvas.Controls
{
    /// <summary>
    /// Interaction logic for TextBoxControl.xaml
    /// </summary>
    public partial class NumericTextBoxControl 
    {
        public NumericTextBoxControl()
        {
            InitializeComponent();
        }

        private void TextBoxPreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            var regex = new Regex("[^0-9.-]+"); //regex that matches disallowed text

            e.Handled= regex.IsMatch(e.Text);
        }
    }
}
